package com.example.demo;

import com.example.demo.model.MyList;
import com.example.demo.model.Student;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Test {
    //用户自定义配置读取
//    @Value("${myKey.key1}")
//    private String mykey;
//
    @Value("${myString}")
    private String myString;
//
//    //读取系统的配置项
//    @Value("${server.port}")
//    private  Integer port;
    @Value("${string.str1}")
    private String str1;
    @Value("${string.str2}")
    private String str2;
    @Value("${string.str3}")
    private String str3;

    @Autowired
    private Student student;

    @Autowired
    private MyList myList;

    //1.得到日志对象
    private static Logger log=LoggerFactory.getLogger(Test.class);

    @RequestMapping("/hh")
    public String hh(){
//        System.out.println(str1);
//        System.out.println();
//        System.out.println(str2);
//        System.out.println();
//        System.out.println(str3);
        //使用日志对象提供的方法进行打印
        log.trace("Hi, i am trace");
        log.debug("Hi,i am debug");
        log.info("Hi,i am info");
        log.warn("Hi,i am warn");
        log.error("Hi, i am error");

        return "hi "+myList.getDbtypes().size()+"| get(0):"+myList.getDbtypes().get(0);
    }
}
